package com.haojin.contacs;

import java.util.Scanner;
public class Arraydemo {
public static void main(String[] args) {
	int student;
	Scanner input = new Scanner(System.in);
	System.out.println("请输入学生人数：");
	student = input.nextInt();
	int[] grade = new int[student];
	System.out.println("请输入"+student+"个学生各自的成绩:");
	for(int i = 0;i < grade.length; i++){
		grade[i] = input.nextInt();
	}
	int max = grade[0];
	for(int j= 1;j < grade.length; j++){
		max = (max >= grade[j])?max:grade[j];
	}
	for(int k=0;k<grade.length;k++){
		if(grade[k]>=max-10){
			System.out.println("Student "+k+" sorce is "+grade[k]+" grade is "+"A");
		}
		else if(grade[k]>=max-20){
			System.out.println("Student "+k+" sorce is "+grade[k]+" grade is "+"B");
		}
		else if(grade[k]>=max-30){
			System.out.println("Student "+k+" sorce is "+grade[k]+" grade is "+"C");
		}
		else{
			System.out.println("Student "+k+" sorce is "+grade[k]+" grade is "+"D");
		}
	}
	
}
}
